package kz.edu.sdu.atm.server;

import java.io.PrintWriter;
import java.util.Scanner;

import kz.edu.sdu.atm.models.Request;
import kz.edu.sdu.atm.models.Response;

public abstract class IComProtocol {
	Scanner in;
	PrintWriter out;
	IServer server;

	public IComProtocol() {

	}


	public abstract Request readRequest(Scanner in);

	public abstract void writeResponse(PrintWriter out, Response res);

	public void speak() {
		Request req = readRequest(in);
		Response res = new Response();
		server.request(req, res);
		writeResponse(out, res);
	}
}
